fix: rectangular-mesh plot edges follow the mapper node convention#375
Merged
Conversation
The bilinear interpolation mapper places reconstruction value (row r, col c) at node U_y=(n_y-r-1)/(n_y-3), U_x=(c-1)/(n_x-3) in unit CDF space (guard ring at the border, rows flipped by the mapper's row = n - i), but edges_transformed drew a uniform [0,1] partition — pcolormesh plots put flux up to ~1.5 mesh pixels from where the mapper scatters it (the "small offsets" of issue #372, confirmed by a delta-function reproduction). The edges are now the node midpoints pushed through the same CDF machinery (guard-safe denominator for degenerate n<=3 meshes; border guard cells clamp to the data span). Both consumers inherit the fix: the pcolormesh plot path and rectangular_rotated's warped-centre reconstruction; spline and linear CDFs share the upstream index convention. Plot geometry only — the mapper is untouched, so inversions and likelihoods are byte-identical. #372 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
Verification of this fix (visual pipeline + strict node-containment / mapper-faithfulness checks, incl. on the new kernel-CDF meshes of #374) posted on the issue: #372 — confirmed, no residual offsets. Recommend merging this PR first; #374 already contains c177391 and has re-validated on the combined tree. |
This was referenced Jul 10, 2026
This was referenced Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #372 — the reported "small offsets" in rectangular-mesh source-reconstruction plots. The bilinear interpolation mapper places value (row r, col c) at node
U_y=(n_y−r−1)/(n_y−3),U_x=(c−1)/(n_x−3)in unit CDF space (guard ring,row = n − iflip), whileedges_transformeddrew a uniform[0,1]partition —pcolormeshput flux up to ~1.5 mesh pixels from where the mapper scatters it (delta-function reproduction on the issue). Edges are now the node midpoints through the same CDF machinery (guard-safemax(n−3,1)denominator; border guard cells clamp to the data span). Both consumers inherit the fix: thepcolormeshplot path andrectangular_rotated's warped-centre reconstruction; spline + linear CDFs share the upstream convention.Plot geometry only — the mapper is untouched; inversions/likelihoods are byte-identical. Only where flux is drawn moves.
API Changes
Changed behaviour:
RectangularMeshGeometry.edges_transformedreturns mapper-consistent node-midpoint edges (previously a uniform unit-space partition). Consumers that treated it as a uniform grid see shifted (now correct) cell boundaries; the 3×3 degenerate case is value-identical via CDF clamping. Docstring corrected (was a copy-paste about pixel neighbors).Test Plan
pytest test_autoarray/ -q— 877 passed (incl. new delta-centroid regression: pre-fix uniform edges miss by ~0.4 units ≈ 1.5 cells in y; existingtest__edges_transformedand rotated-mesh ghost tests unchanged)Validation checklist (--auto run)
🤖 Generated with Claude Code